home *** CD-ROM | disk | FTP | other *** search
Wrap
CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) NNNNAAAAMMMMEEEE CCCCFFFFIIIIRRRR1111DDDD, ZZZZFFFFIIIIRRRR1111DDDD, SSSSFFFFIIIIRRRR1111DDDD, DDDDFFFFIIIIRRRR1111DDDD - Compute the 1D convolution of a sequence SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS Single precision complex Fortran: CCCCAAAALLLLLLLL CCCCFFFFIIIIRRRR1111DDDD ((((_x,,,, _i_n_c_x,,,, _i_x_0,,,, _n_x,,,, _h,,,, _i_n_c_h,,,, _i_h_0,,,, _n_h,,,, _y,,,, _i_n_c_y,,,, _i_y_0,,,, _n_y,,,, _a_l_p_h_a,,,, _b_e_t_a)))) C/C++: ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>> vvvvooooiiiidddd ccccffffiiiirrrr1111dddd(((( ssssccccssssllll____ccccoooommmmpppplllleeeexxxx *_x,,,, iiiinnnntttt _i_n_c_x,,,, iiiinnnntttt _i_x_0,,,, iiiinnnntttt _n_x,,,, ssssccccssssllll____ccccoooommmmpppplllleeeexxxx *_h,,,, iiiinnnntttt _i_n_c_h,,,, iiiinnnntttt _i_h_0,,,, iiiinnnntttt _n_h,,,, ssssccccssssllll____ccccoooommmmpppplllleeeexxxx *_y,,,, iiiinnnntttt _i_n_c_y,,,, iiiinnnntttt _i_y_0,,,, iiiinnnntttt _n_y,,,, ssssccccssssllll____ccccoooommmmpppplllleeeexxxx *_a_l_p_h_a,,,, ssssccccssssllll____ccccoooommmmpppplllleeeexxxx *_b_e_t_a))));;;; C++ STL: ####iiiinnnncccclllluuuuddddeeee <<<<ccccoooommmmpppplllleeeexxxx....hhhh>>>> ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>> vvvvooooiiiidddd ccccffffiiiirrrr1111dddd(((( ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>> *_x,,,, iiiinnnntttt _i_n_c_x,,,, iiiinnnntttt _i_x_0,,,, iiiinnnntttt _n_x,,,, ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>> *_h,,,, iiiinnnntttt _i_n_c_h,,,, iiiinnnntttt _i_h_0,,,, iiiinnnntttt _n_h,,,, ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>> *_y,,,, iiiinnnntttt _i_n_c_y,,,, iiiinnnntttt _i_y_0,,,, iiiinnnntttt _n_y,,,, ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>> *_a_l_p_h_a,,,, ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>> *_b_e_t_a))));;;; Double precision complex Fortran: CCCCAAAALLLLLLLL ZZZZFFFFIIIIRRRR1111DDDD ((((_x,,,, _i_n_c_x,,,, _i_x_0,,,, _n_x,,,, _h,,,, _i_n_c_h,,,, _i_h_0,,,, _n_h,,,, _y,,,, _i_n_c_y,,,, _i_y_0,,,, _n_y,,,, _a_l_p_h_a,,,, _b_e_t_a)))) C/C++: ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>> vvvvooooiiiidddd zzzzffffiiiirrrr1111dddd(((( ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx *_x,,,, iiiinnnntttt _i_n_c_x,,,, iiiinnnntttt _i_x_0,,,, iiiinnnntttt _n_x,,,, ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx *_h,,,, iiiinnnntttt _i_n_c_h,,,, iiiinnnntttt _i_h_0,,,, iiiinnnntttt _n_h,,,, ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx *_y,,,, iiiinnnntttt _i_n_c_y,,,, iiiinnnntttt _i_y_0,,,, iiiinnnntttt _n_y,,,, ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx *_a_l_p_h_a,,,, ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx *_b_e_t_a))));;;; C++ STL: ####iiiinnnncccclllluuuuddddeeee <<<<ccccoooommmmpppplllleeeexxxx....hhhh>>>> ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>> vvvvooooiiiidddd zzzzffffiiiirrrr1111dddd(((( ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>> *_x,,,, iiiinnnntttt _i_n_c_x,,,, iiiinnnntttt _i_x_0,,,, iiiinnnntttt _n_x,,,, ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>> *_h,,,, iiiinnnntttt _i_n_c_h,,,, iiiinnnntttt _i_h_0,,,, iiiinnnntttt _n_h,,,, ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>> *_y,,,, iiiinnnntttt _i_n_c_y,,,, iiiinnnntttt _i_y_0,,,, iiiinnnntttt _n_y,,,, ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>> *_a_l_p_h_a,,,, ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>> *_b_e_t_a))));;;; Single precision Fortran: CCCCAAAALLLLLLLL SSSSFFFFIIIIRRRR1111DDDD ((((_x,,,, _i_n_c_x,,,, _i_x_0,,,, _n_x,,,, _h,,,, _i_n_c_h,,,, _i_h_0,,,, _n_h,,,, _y,,,, _i_n_c_y,,,, _i_y_0,,,, _n_y,,,, _a_l_p_h_a,,,, _b_e_t_a)))) PPPPaaaaggggeeee 1111 CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) C/C++: ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>> vvvvooooiiiidddd ssssffffiiiirrrr1111dddd(((( ffffllllooooaaaatttt *_x,,,, iiiinnnntttt _i_n_c_x,,,, iiiinnnntttt _i_x_0,,,, iiiinnnntttt _n_x,,,, ffffllllooooaaaatttt *_h,,,, iiiinnnntttt _i_n_c_h,,,, iiiinnnntttt _i_h_0,,,, iiiinnnntttt _n_h,,,, ffffllllooooaaaatttt *_y,,,, iiiinnnntttt _i_n_c_y,,,, iiiinnnntttt _i_y_0,,,, iiiinnnntttt _n_y,,,, ffffllllooooaaaatttt _a_l_p_h_a,,,, ffffllllooooaaaatttt _b_e_t_a))));;;; Double precision Fortran: CCCCAAAALLLLLLLL DDDDFFFFIIIIRRRR1111DDDD ((((_x,,,, _i_n_c_x,,,, _i_x_0,,,, _n_x,,,, _h,,,, _i_n_c_h,,,, _i_h_0,,,, _n_h,,,, _y,,,, _i_n_c_y,,,, _i_y_0,,,, _n_y,,,, _a_l_p_h_a,,,, _b_e_t_a)))) C/C++: ####iiiinnnncccclllluuuuddddeeee <<<<ssssccccssssllll____fffffffftttt....hhhh>>>> vvvvooooiiiidddd ddddffffiiiirrrr1111dddd(((( ddddoooouuuubbbblllleeee *_x,,,, iiiinnnntttt _i_n_c_x,,,, iiiinnnntttt _i_x_0,,,, iiiinnnntttt _n_x,,,, ddddoooouuuubbbblllleeee *_h,,,, iiiinnnntttt _i_n_c_h,,,, iiiinnnntttt _i_h_0,,,, iiiinnnntttt _n_h,,,, ddddoooouuuubbbblllleeee *_y,,,, iiiinnnntttt _i_n_c_y,,,, iiiinnnntttt _i_y_0,,,, iiiinnnntttt _n_y,,,, ddddoooouuuubbbblllleeee _a_l_p_h_a,,,, ddddoooouuuubbbblllleeee _b_e_t_a))));;;; IIIIMMMMPPPPLLLLEEEEMMMMEEEENNNNTTTTAAAATTTTIIIIOOOONNNN These routines are part of the SCSL Scientific Library and can be loaded using either the ----llllssssccccssss or the ----llllssssccccssss____mmmmpppp option. The ----llllssssccccssss____mmmmpppp option directs the linker to use the multi-processor version of the library. When linking to SCSL with ----llllssssccccssss or ----llllssssccccssss____mmmmpppp, the default integer size is 4 bytes (32 bits). Another version of SCSL is available in which integers are 8 bytes (64 bits). This version allows the user access to larger memory sizes and helps when porting legacy Cray codes. It can be loaded by using the ----llllssssccccssss____iiii8888 option or the ----llllssssccccssss____iiii8888____mmmmpppp option. A program may use only one of the two versions; 4-byte integer and 8-byte integer library calls cannot be mixed. The C and C++ prototypes shown above are appropriate for the 4-byte integer version of SCSL. When using the 8-byte integer version, the variables of type iiiinnnntttt become lllloooonnnngggg lllloooonnnngggg and the <<<<ssssccccssssllll____fffffffftttt____iiii8888....hhhh>>>> header file should be included. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN These routines compute the convolution of the finite impulse response filter _h with a vector _x, producing the output vector _y. _y = beta * _y + alpha * _h * _x Suppose _h and _x are two sequences of numbers having _n_h and _n_x elements respectively: h = [h(0), h(1), , h(nh - 1) ] , and x = [x(0), x(1), , x(nx - 1) ] . The convolution product, _y = _h****_x, is the sequence that has _n_h + _n_x - 1 non-zero elements defined by the following: PPPPaaaaggggeeee 2222 CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) nh-1 y(j) = Sum [h(k)x(j-k)] for j=0, ...,nx+nh-2 j=0 y(0) = h(0)*x(0) y(1) = h(0)*x(1) + h(1)*x(0) y(2) = h(0)*x(2) + h(1)*x(1) + h(2)*x(0) y(nh-1) = h(0)*x(nh-1) + h(1)*x(nh-2) + ... + h(nh-1)*x(0) ... y(j) = h(0)*x(j) + h(1)*x(j-1) + ... + h(nh-1)*x(j-nh+1) ... y(nx-1) = h(0)*x(nx-1) + h(1)*x(nx-2) + ... + h(nh-1)*x(nx-nh) ... y(nx+nh-3) = h(nh-2)*x(nx-1) + h(nh-1)*x(nx-2) y(nx+nh-2) = h(nh-1)*x(nx-1) In the ****FFFFIIIIRRRR1111DDDD routines, the number of terms in the output sequence is specified by an argument, _n_y. If _n_y < _n_h + _n_x - 1 the sequence _y is truncated. If _n_y > _n_h + _n_x - 1 the terms beyond _y(_n_h + _n_x - 2) are set to 0. Generally, the sequences _x, _h and _y represent signals sampled at equal time intervals, and the indexes of the vectors denote the sample times. If all three signals begin at the same time, we may, without loss of generality, set the initial time to 0, as in the formulas above. The ****FFFFIIIIRRRR1111DDDD routines, however, permit more generality than this. The signals may be time shifted from each other using input parameters specifiying the initial time sample for each signal. This can be useful in several situations. For example, if the input array has several leading zero values that one does not wish to store, iiiixxxx0000 may be set to the time sample corresponding to the first non-zero element in the input array, and earlier time samples are treated as 0. Another use is to limit the output to just the "fully engaged" terms of the convolution. As can be seen above, when _n_x>= _n_h, the convolution has ramp-up and ramp-down regions in which fewer than all _n_h filter values contribute to the output value. Setting iiiiyyyy0000 to _n_h-1 causes the first value output to correspond to time sample _n_h-1, thus skipping the ramp-up region. Setting _n_y to _n_x-_n_h+1 then drops the ramp-down terms, limiting the output to just the fully engaged part. Note that, instead of 0, the initial time could just as easily have been labeled 1 or 10 or -78; the relevant point is that the first elements of each of the _x, _h and _y arrays are defined to be the same time sample as long as iiiixxxx0000 ==== iiiihhhh0000 ==== iiiiyyyy0000. PPPPaaaaggggeeee 3333 CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) See the NOTES section of this man page for information about the interpretation of the data types described in the following arguments. These routines have the following arguments: _x Array of dimension _n_x. (input). CCCCFFFFIIIIRRRR1111DDDD: Single precision complex array. ZZZZFFFFIIIIRRRR1111DDDD: Double precision complex array. SSSSFFFFIIIIRRRR1111DDDD: Single precision array. DDDDFFFFIIIIRRRR1111DDDD: Double precision array. Input sequences to be convolved with _h. _i_n_c_x Integer. (input) The increment between two successive values of _x. _i_n_c_x must not be 0. _i_x_0 Integer. (input) Time sample corresponding to the first element of _x. _n_x Integer. (input) The number of elements in the sequence _x. _n_x >= 0. _h Array of dimension _n_h. (input). CCCCFFFFIIIIRRRR1111DDDD: Single precision complex array. ZZZZFFFFIIIIRRRR1111DDDD: Double precision complex array. SSSSFFFFIIIIRRRR1111DDDD: Single precision array. DDDDFFFFIIIIRRRR1111DDDD: Double precision array. Input sequence to be convolved with _x. _i_n_c_h Integer. (input) Increment between two successive values of _h. _i_n_c_h must not be 0. _i_h_0 Integer. (input) Time sample corresponding to the first element of _h. _n_h Integer. (input) The number of elements in the sequence _h. _n_h >= 0. _y Array of dimension _n_y. (input and output). CCCCFFFFIIIIRRRR1111DDDD: Single precision complex array. ZZZZFFFFIIIIRRRR1111DDDD: Double precision complex array. SSSSFFFFIIIIRRRR1111DDDD: Single precision array. DDDDFFFFIIIIRRRR1111DDDD: Double precision array. Output of the FIR filter. On entry, the array _y must have been initialized, except except when beta is 0; in that case, _y need not be initialized. On exit, the result overwrites _y. _i_n_c_y Integer. (input) Increment between two successive values of _y. _i_n_c_y must not be 0. PPPPaaaaggggeeee 4444 CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) _i_y_0 Integer. (input) Time sample corresponding to the first element of _y. _n_y Integer. (input) Number of elements in the sequence _y. _n_y >= 0. _a_l_p_h_a Scale factor for the convolution. (input). CCCCFFFFIIIIRRRR1111DDDD: Single precision complex. ZZZZFFFFIIIIRRRR1111DDDD: Double precision complex. SSSSFFFFIIIIRRRR1111DDDD: Single precision. DDDDFFFFIIIIRRRR1111DDDD: Double precision. For C/C++, a pointer to this value is passed. _b_e_t_a Scale factor for the output _y. (input) CCCCFFFFIIIIRRRR1111DDDD: Single precision complex. ZZZZFFFFIIIIRRRR1111DDDD: Double precision complex. SSSSFFFFIIIIRRRR1111DDDD: Single precision. DDDDFFFFIIIIRRRR1111DDDD: Double precision. When _b_e_t_a is supplied as 0, _y need not be set on input. For C/C++, a pointer to this value is passed. NNNNOOOOTTTTEEEESSSS The following data types are described in this documentation: TTTTeeeerrrrmmmm UUUUsssseeeedddd DDDDaaaattttaaaa ttttyyyyppppeeee Fortran: Array dimensioned 0000........_n----1111 xxxx((((0000::::nnnn----1111)))) Array of dimensions (_m,_n) xxxx((((mmmm,,,,nnnn)))) Array of dimensions (_m,_n,_p) xxxx((((mmmm,,,,nnnn,,,,pppp)))) IIIInnnntttteeeeggggeeeerrrr IIIINNNNTTTTEEEEGGGGEEEERRRR (IIIINNNNTTTTEEEEGGGGEEEERRRR****8888 for ----llllssssccccssss____iiii8888[[[[____mmmmpppp]]]]) Single precision RRRREEEEAAAALLLL Double precision DDDDOOOOUUUUBBBBLLLLEEEE PPPPRRRREEEECCCCIIIISSSSIIIIOOOONNNN Single precision complex CCCCOOOOMMMMPPPPLLLLEEEEXXXX Double precision complex DDDDOOOOUUUUBBBBLLLLEEEE CCCCOOOOMMMMPPPPLLLLEEEEXXXX C/C++: Array dimensioned 0000........_n----1111 xxxx[[[[_n]]]] Array of dimensions (_m,_n) xxxx[[[[mmmm****nnnn]]]] oooorrrr xxxx[[[[nnnn]]]][[[[mmmm]]]] PPPPaaaaggggeeee 5555 CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) Array of dimensions (_m,_n,_p) xxxx[[[[mmmm****nnnn****pppp]]]] oooorrrr xxxx[[[[pppp]]]][[[[nnnn]]]][[[[mmmm]]]] Integer iiiinnnntttt (lllloooonnnngggg lllloooonnnngggg for ----llllssssccccssss____iiii8888[[[[____mmmmpppp]]]]) Single precision ffffllllooooaaaatttt Double precision ddddoooouuuubbbblllleeee Single precision complex ssssccccssssllll____ccccoooommmmpppplllleeeexxxx Double precision complex ssssccccssssllll____zzzzoooommmmpppplllleeeexxxx C++ STL: Array dimensioned 0000........_n----1111 xxxx[[[[_n]]]] Array of dimensions (_m,_n) xxxx[[[[mmmm****nnnn]]]] oooorrrr xxxx[[[[nnnn]]]][[[[mmmm]]]] Array of dimensions (_m,_n,_p) xxxx[[[[mmmm****nnnn****pppp]]]] oooorrrr xxxx[[[[pppp]]]][[[[nnnn]]]][[[[mmmm]]]] Integer iiiinnnntttt (lllloooonnnngggg lllloooonnnngggg for ----llllssssccccssss____iiii8888[[[[____mmmmpppp]]]]) Single precision ffffllllooooaaaatttt Double precision ddddoooouuuubbbblllleeee Single precision complex ccccoooommmmpppplllleeeexxxx<<<<ffffllllooooaaaatttt>>>> Double precision complex ccccoooommmmpppplllleeeexxxx<<<<ddddoooouuuubbbblllleeee>>>> CCCCAAAAUUUUTTTTIIIIOOOONNNNSSSS The arrays _x, _h, and _y must be non-overlapping. EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS The following example computes the convolution of a 4-sample sequence _x with a filter _h containing 3 samples. Fortran: REAL X(0:3), H(0:2), Y(0:5) REAL ALPHA, BETA ALPHA = 1.0 BETA = 0.0 X(0) = 1.0 DO I = 1, 3 X(I) = -1.0 ENDDO DO I = 0, 2 H(I) = 1.0/(I+1) ENDDO CALL SFIR1D(X(0), 1, 0, 4, H(0), 1, 0, 3, Y(0), 1, 0, 6, PPPPaaaaggggeeee 6666 CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) CCCCFFFFIIIIRRRR1111DDDD((((3333SSSS)))) & ALPHA, BETA) C/C++: #include <scsl_fft.h> float x[4], h[3], y[6]; float alpha = 1.0f; float beta = 0.0f; int i; x[0] = 1.0f for (i=1; i<4; i++) { x[i] = -1.0f; } for (i=0; i<3; i++) { h[i] = 1.0f/(i+1); } sfir1d(x, 1, 0, 4, h, 1, 0, 3, y, 1, 0, 6, alpha, beta); The output is the following: Y(0) Y(1) Y(2) Y(3) Y(4) Y(5) 1.0000 -0.5000 -1.1667 -1.8333 -0.8333 -0.3333 Changing the values for iiiixxxx0000, iiiihhhh0000 and iiiiyyyy0000 produces the following shifts in the output: Y(0) Y(1) Y(2) Y(3) Y(4) Y(5) ix0 = +1: 0.0000 1.0000 -0.5000 -1.1667 -1.8333 -0.8333 ix0 = +2: 0.0000 0.0000 1.0000 -0.5000 -1.1667 -1.8333 ix0 = -1: -0.5000 -1.1667 -1.8333 -0.8333 -0.3333 0.0000 ix0 = -2: -1.1667 -1.8333 -0.8333 -0.3333 0.0000 0.0000 ih0 = +1: 0.0000 1.0000 -0.5000 -1.1667 -1.8333 -0.8333 ih0 = +2: 0.0000 0.0000 1.0000 -0.5000 -1.1667 -1.8333 ih0 = -1: -0.5000 -1.1667 -1.8333 -0.8333 -0.3333 0.0000 ih0 = -2: -1.1667 -1.8333 -0.8333 -0.3333 0.0000 0.0000 iy0 = +1: -0.5000 -1.1667 -1.8333 -0.8333 -0.3333 0.0000 iy0 = +2: -1.1667 -1.8333 -0.8333 -0.3333 0.0000 0.0000 iy0 = -1: 0.0000 1.0000 -0.5000 -1.1667 -1.8333 -0.8333 iy0 = -2: 0.0000 0.0000 1.0000 -0.5000 -1.1667 -1.8333 SSSSEEEEEEEE AAAALLLLSSSSOOOO IIIINNNNTTTTRRRROOOO____FFFFFFFFTTTT(3S), IIIINNNNTTTTRRRROOOO____SSSSCCCCSSSSLLLL(3S) PPPPaaaaggggeeee 7777